<template>
	<view>
		<view class="content">
			<view class="card">
				<view class="title">
					数据概览
				</view>
				<view class="list items-center justify-between">
					<view class="item">
						<view class="num">
							{{info.d1 || 0}}
						</view>
						<view class="text">
							今日收益
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d2 || 0}}
						</view>
						<view class="text">
							周收益
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d3 || 0}}
						</view>
						<view class="text">
							月收益
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d4 || 0}}
						</view>
						<view class="text">
							总收益
						</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">
					汽车充电站概览
				</view>
				<view class="list items-center justify-between">
					<view class="item">
						<view class="num">
							{{info.d5 || 0}}
						</view>
						<view class="text">
							总台数
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d6 || 0}}
						</view>
						<view class="text">
							在线数
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d7 || 0}}
						</view>
						<view class="text">
							使用中
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d8 || 0}}
						</view>
						<view class="text">
							空闲
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d9 || 0}}
						</view>
						<view class="text">
							离线数
						</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">
					电动车充电站概览
				</view>
				<view class="list items-center justify-between">
					<view class="item">
						<view class="num">
							{{info.d10 || 0}}
						</view>
						<view class="text">
							总台数
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d11 || 0}}
						</view>
						<view class="text">
							在线数
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d12 || 0}}
						</view>
						<view class="text">
							使用中
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d13 || 0}}
						</view>
						<view class="text">
							空闲
						</view>
					</view>
					<view class="item">
						<view class="num">
							{{info.d14 || 0}}
						</view>
						<view class="text">
							离线数
						</view>
					</view>
				</view>
			</view>
			<view class="card items-center justify-around">
				<view class="items" @click="type == '1' ? navTo('./me-power?type=1') : ''">
					<view class="num">
						{{info.d15}}
					</view>
					<view class="text">
						汽车充电站管理
					</view>
				</view>
				<view class="items" @click="type == '1' ? navTo('./me-power?type=2') : ''">
					<view class="num">
						{{info.d16}}
					</view>
					<view class="text">
						电动车充电站管理
					</view>
				</view>
			</view>
			<view class="card btn" @click="navTo('./wallet?type='+type)">
				收入钱包
			</view>
			<view class="card btn" @click="navTo('./operate?type='+type)">
				经营数据
			</view>
		</view>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				type:'1'
			};
		},
		onLoad(e) {
			if(e.type) this.type = e.type
		},
		onShow() {
			this.infoFn()
		},
		methods:{
			async infoFn(){
				let res = await this.$request('user/zz-home',{
					uid:uni.getStorageSync('uid')
				},{ showLoading: true })
				if(res.result == '0'){
					this.info = res.data
				}
			}
		},
	}
</script>

<style lang="scss" scoped> 
	.content{
		padding: 20rpx;
		.card{
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 30rpx;
			margin-bottom: 30rpx;
			.title{
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #222222;
				line-height: 40rpx;
				padding-bottom: 20rpx;
				border-bottom: 1rpx solid #E7E7E7;
				margin-bottom: 20rpx;
			}
			.list{
				.item{
					width: calc(100% / 5);
					.num{
						width: 100%;
						overflow:hidden; //超出的文本隐藏
						text-overflow:ellipsis; //溢出用省略号显示
						white-space:nowrap; //溢出不换行
						font-size: 34rpx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #080808;
						text-align: center;
					}
					.text{
						width: 100%;
						overflow:hidden; //超出的文本隐藏
						text-overflow:ellipsis; //溢出用省略号显示
						white-space:nowrap; //溢出不换行
						font-size: 26rpx;
						font-family: PingFang SC;
						color: #919191;
						text-align: center;
					}
				}
			}
			.items{
				text-align: center;
				.num{
					font-size: 34rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #080808;
				}
				.text{
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #919191;
				}
			}
		}
		.btn{
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #222222;
			line-height: 36rpx;
			text-align: center;
		}
	}
</style>
